import axios from "axios";

//baseURL
const development = 'http://172.26.2.18:8081';
// const development = 'https://www.huangmin.work';

//axios
export const networkRequest = axios;

//session配置
export const sessionConfig = {
    baseURL: development,
    url: '***',
    data: '***',
    method: 'post',
    timeout: 1000 * 60,
    headers: {
        'Content-Type': 'text/plain;charset=UTF-8',
    },
    transformRequest: [function (data, headers) {
        // 对发送的 data 进行任意转换处理
        //1、map转对象
        const str = Object.fromEntries(data);
        //2、对象转字符串
        const str1 = JSON.stringify(str);
        return str1;
    }],
    transformResponse: [function (data) {
        //转json对象
        const newData = JSON.parse(data);
        return newData;
    }],
}
